Skip to content

Fix algorithm function callback result type handling and remove unsafe 'any' cast#431

Open
MatrixNeoKozak wants to merge 1 commit into
webpack:mainfrom
MatrixNeoKozak:scout-improvement-1780226985641
Open

Fix algorithm function callback result type handling and remove unsafe 'any' cast#431
MatrixNeoKozak wants to merge 1 commit into
webpack:mainfrom
MatrixNeoKozak:scout-improvement-1780226985641

Conversation

@MatrixNeoKozak

Copy link
Copy Markdown

In src/index.js, the runCompressionAlgorithm method casts the callback result to Buffer.from(...) but the type definition allows multiple types. The current code checks Buffer.isBuffer(result) and falls back to Buffer.from(string), which is unsafe because the result might be a Uint8Array or other types. This change removes the unsafe fallback and uses Buffer.from(result) directly, which correctly handles all valid types (string, Uint8Array, ArrayBuffer, etc.). Also removes the JSDoc from the private options and algorithm fields since they are already typed and the comment is redundant for maintainers.

@linux-foundation-easycla

Copy link
Copy Markdown

CLA Missing ID

  • ❌ The email address for the commit (b1188fe) is not linked to the GitHub account, preventing the EasyCLA check. Consult this Help Article and GitHub Help to resolve. (To view the commit's email address, add .patch at the end of this PR page's URL.) For further assistance with EasyCLA, please visit our EasyCLA portal and chat with our support bot.

@alexander-akait

Copy link
Copy Markdown
Member

Please accept CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants